<?xml version="1.0" encoding="UTF-8"?>
<%@page contentType="text/html; charset=UTF-8" %>
<%
	String id = request.getParameter("id");

	Session hSession = HibernateUtil.getSessionFactory().getCurrentSession();
	Category category = (Category) hSession.get(Category.class, Long.valueOf(id));
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
	<title>Bookstore :: <%=category.getTitle()%></title>
	<%@include file="include.jsp" %>
</head>

<body>
	<%@include file="commun.jsp" %>
	
	<div class="contenuAvecMenu contenuAvecOutils">
		<h2><%=category.getTitle()%></h2>
		
		<% for (Book book : category.getBooks()) { %>
		<div class="boite bleue">
			<div class="cover">
				<img src="Image.do?id=<%=book.getId()%>" alt="" />
			</div>
			<h4 id="BOOK<%=book.getId()%>"><%=book%></h4>
			<em><%=FormatUtil.formatDate(book.getDate())%></em>
			<br />
			Ecrit par
			<%
				String virgule = "";
				for (Author author : book.getAuthors()) {
			%>
				<%=virgule%>
				<%=author%>
			<%
					virgule = ",";
				}
			%>
			<div class="prix"><%=FormatUtil.formatPrice(book.getPrice())%></div>
			<a href="AddBook.do?id=<%=book.getId()%>">Ajouter au panier</a>
		
		</div>
		<% } %>
	</div>
</body>
</html>
